<%@page import="exam.common.util.NullCheckUtil"%>
<%@page import="exam.common.util.KeyCommon"%>
<%@page import="exam.model.entity.TAnswerEntity"%>
<%@page import="java.util.List"%>
<%@page import="exam.model.entity.TQuestionEntity"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Thông tin đề thi</title>
</head>
<body>
<table>
	<s:iterator value="tExaminationEntity">
		<tr>
			<td>#</td>
			<td><s:property value="examId" /></td>
		</tr>
		<tr>
			<td>Mã đề</td>
			<td><s:property value="examCd" /></td>
		</tr>
		<tr>
			<td>Tiêu đề</td>
			<td>
				<s:property value="examTitle" />
			</td>
		</tr>
		<tr>
			<td>Số câu hỏi:</td>
			<td><s:property value="questNum" /></td>
		</tr>
		<tr>
			<td>Thời gian thi:</td>
			<td><s:property value="examTime" /></td>
		</tr>
		<tr>
			<td>Trạng thái:</td>
			<td>
				<s:if test="status==1">
					Đã thi	
				</s:if>
				<s:else>
					Chưa thi
				</s:else>
			</td>
		</tr>
		<tr>
			<td>Chủ đề:</td>
			<td><s:property value="subQuestionEntity.subject" /></td>
		</tr>
		<tr>
			<td>Ngày tạo:</td>
			<td><s:property value="createDate" /></td>
		</tr>
		<tr>
			<td>Ngày cập nhật:</td>
			<td><s:property value="updateDate" /></td>
		</tr>
	</s:iterator>
</table>
<%
	List<TQuestionEntity> tQuestionEntityList = (List<TQuestionEntity>) session.getAttribute(KeyCommon.T_QUESTION_ENTITY_LIST);
	List<TAnswerEntity> tAnswerEntityList = (List<TAnswerEntity>) session.getAttribute(KeyCommon.T_ANSWER_ENTITY_LIST);
	if(NullCheckUtil.isNotNull(tQuestionEntityList)) {
		session.removeAttribute(KeyCommon.T_QUESTION_ENTITY_LIST);
		session.removeAttribute(KeyCommon.T_ANSWER_ENTITY_LIST);
		for(TQuestionEntity question : tQuestionEntityList) {
%>
		<div>Noi dung cau hoi: <%=question.getQuestionContent()%></div>
<%
			String type="radio";
			String name="correct";
			int i = 0;
			for(TAnswerEntity answer : tAnswerEntityList) {
				if (question.getQuestionId() == answer.getQuestionId()) {
%>
				<div>
					<%
						if (question.getQuestionType() == 1) {
							type = "checkbox";
							name = "correct_" + i;
						}
					%>
					<input type="<%=type%>" name="<%=name%>" />
					<%=answer.getAnswerContent()%> - <%=answer.getAnswerCorrect()%>
				</div>
<%
				}
			}
		}
	}
%>
<s:a href="indexExamination.action">Trở về</s:a>
</body>
</html>